/*
Author: Anuj Gakhar
Web: www.anujgakhar.com
*/

package com.coldfusiondocs.delegate 
{
	import mx.rpc.AsyncToken;
	import mx.rpc.soap.mxml.WebService;
	import com.coldfusiondocs.delegate.ILinkDelegate;
	
	public class LinkDelegate implements ILinkDelegate
	{
    	[Inject(source="linkService")]
    	public var linkService:WebService;
    			
		public function getLinksByObject(_item:String):AsyncToken
		{
			//send the request
			this.linkService.loadWSDL();
			return this.linkService.getLinksByObject(_item);
		}
		
		public function addLink(_data:Object):AsyncToken
		{
			//get the vars
			var _addedBy:String = _data.addedBy;
			var _link:String = _data.link;
			var _linktitle:String = _data.linktitle;
			var _object:String = _data.object;
			var _email:String = _data.email;
			
			// send the request
			this.linkService.loadWSDL();
			return this.linkService.addLink(_addedBy, _email, _link, _object, _linktitle);
		}		
		
	}
}